<!DOCTYPE HTML>
<html>
<h3><center>DAFTAR AKUN</center></h3>
<a><center>
<?php

	mysql_connect("localhost","root","");
	mysql_select_db("ngalam");
	$dataPerPage = 5;
	$query   = "SELECT COUNT(*) AS nama FROM profil_akun";
	$hasil1  = mysql_query($query);
	$data1   = mysql_fetch_array($hasil1);

	$Nama = $data1['nama'];
	// menentukan jumlah halaman yang muncul berdasarkan jumlah semua data

	$jumPage = ceil($Nama/$dataPerPage);

	// menampilkan link previous

		if ($noPage > 1) echo  "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage-1)."'>&lt;&lt; Prev</a>";

	// memunculkan nomor halaman dan linknya

			for($page = 1; $page <= $jumPage; $page++)
				{
						 if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage)) 
						 {   
							if (($showPage == 1) && ($page != 2))  echo "..."; 
							if (($showPage != ($jumPage - 1)) && ($page == $jumPage))  echo "...";
							if ($page == $noPage) echo " <b>".$page."</b> ";
							else echo " <a href='".$_SERVER['PHP_SELF']."?page=".$page."'>".$page."</a> ";
							$showPage = $page;          
						 }
				}

// menampilkan link next

					if ($noPage < $jumPage) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage+1)."'>Next &gt;&gt;</a>";

?>
</center>
</a>
	<table align="center" class="tabel table-condensed "  width="900" border="10" cellpadding="5" cellspacing="1" background="magenta" >
		<tr class="success">
			<th>nama</th>
			<th>jenis_kelamin</th>
			<th>tanggal_lahir</th>
			<th>tempat_lahir</th>
			<th>email</th>
			<th>hak_akses</th>
	
	
		</tr>

<?php

	mysql_connect("localhost","root","");
	mysql_select_db("ngalam");
	$dataPerPage = 5;

// apabila $_GET['page'] sudah didefinisikan, gunakan nomor halaman tersebut, 
// sedangkan apabila belum, nomor halamannya 1.

		if(isset($_GET['page']))
		{
			$noPage = $_GET['page'];
		} 
		else $noPage = 1;

// perhitungan offset

			$offset = ($noPage - 1) * $dataPerPage;


			$sql = "select * from profil_akun LIMIT $offset, $dataPerPage";
			$hasil = mysql_query($sql);
  
			  while($data=mysql_fetch_row($hasil)){
			  echo "<tr>
					  <td>$data[1]</td>
					  <td>$data[2]</td>
					  <td>$data[3]</td>
					  <td>$data[4]</td>
					  <td>$data[5]</td>
						<td>$data[7]</td>
					  </tr>";
					}
?>  
</table>
<strong><center><p><a href="home_adm.php">Halaman Admin &raquo; </a></p></center></strong>

</html>
